package com.yang.Offer;

public class Offer32 {
}

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode(int x) { val = x; }
 * }
 */
/*从上到下打印出二叉树的每个节点，同一层的节点按照从左到右的顺序打印。*/
class Offer32Solution {
   /* public int[] levelOrder(TreeNode root) {
        if(root == null){
            return new int[0];
        }
        // 队列进行层序遍历
        Deque<TreeNode> queue = new LinkedList<>();
        List<Integer> numsList = new ArrayList<>();
        queue.offer(root);

        while(!queue.isEmpty()){
            TreeNode node = queue.poll();
            numsList.add(node.val);
            if(node.left != null){
                queue.offer(node.left);
            }
            if(node.right != null){
                queue.offer(node.right);
            }
        }
        // 一个循环数组进行数据重装
        int[] nums = new int[numsList.size()];
        for(int i = 0; i < numsList.size(); i++){
            nums[i] = numsList.get(i);
        }
        return nums;
    }*/
}
